#include "LE.h"

	LE::LE(int type, Lexem* lexemPtr, int hash, LE* prev) {
		this->type = type;
		this->prev  = prev;
		this->lexemPtr = lexemPtr;
		this->hash = hash;
		next  = NULL;
		valuePtr = NULL;
	}

	LE* LE::getPrev() {
		return prev;
	}

	LE* LE::getNext() {
		return next;
	}

	void LE::setNext(LE* next) {
		this->next = next;
	}

	void LE::setPrev(LE* prev) {
		this->prev = prev;
	}

	double LE::getValue() {
		if (valuePtr == NULL){
			throw "No Value";
		}else{
			return valuePtr->getValue();
		}
	}

	void LE::setIntegerValue(int integer) {
		if (valuePtr == NULL){
			valuePtr = new Value((long) integer);
		}else {
			valuePtr->setInteger((long) integer);
		}
	}

	void LE::setRealValue(double real){
		if (valuePtr == NULL){
			valuePtr = new Value(real);
		}else {
			valuePtr->setReal(real);
		}
	}

	int LE::getType() {
		return type;
	}

	string LE::getLexem(){
		return lexemPtr->getLexem();
	}

	int LE::getHash(){
		return hash;
	}

	Lexem* LE::getLexemPtr(){
		return lexemPtr;
	}